C C -C Programming /C programming language MCQ Questions Set 1 Sample Test,Sample questions

Question:
Find the odd one out.

1.std::vector<int>

2.std::vector<short>

3.std::vector<long>

4.std::vector<bool>


Question:
Identify the user-defined types from the following?

1.enumeration

2.classes

3. both enumeration and classes

4.int


Question:
In which part of the for loop termination condition is checked?  for(I;II;III) {IV}

1.I

2.II

3.III

4.IV


Question:
Is bool a fundamental data type in C++?

1.Yes

2. No, it is a typedef of unsigned char

3.No, it is an enum of {false, true}

4.No, it is expanded from macros


Question:
 Which of the following is correct?

1.A class is an instance of its objects

2. An object is an instance of its class

3.A class is an instance of the data type that the class have

4.An object is an instance of the data type of the class


Question:
Pick the odd one out.

1. array type

2.character type

3.boolean type

4. integer type


Question:
Pick the odd one out.

1.integer, character, boolean, floating

2.enumeration, classes

3.integer, enum, void

4. arrays, pointer, classes


Question:
The value 132.54 can be represented using which data type?

1. double

2. void

3.int

4. bool


Question:
What does ‘\a’ escape code represent?

1.alert

2.backslash

3.tab

4.form feed


Question:
What happens when a null pointer is converted into bool?

1.an error is flagged

2. bool value evaluates to true

3.bool value evaluates to false

4. the statement is ignored


Question:
What happens when a null pointer is converted into bool?

1.an error is flagged

2.bool value evaluates to true

3.bool value evaluates to false

4.the statement is ignored


Question:
What if we define the below structure in C and C++?

1.Error in C but not in C++

2.Error in C++ but not in C

3.No error in both C and C++

4.Error in both C and C++


Question:
What is dynamic binding?

1.The process of linking the actual code with a procedural call during run-time

2.The process of linking the actual code with a procedural call during compile-time

3.The process of linking the actual code with a procedural call at any-time

4.All of the mentioned


Question:
What is name mangling in C++?

1.The process of adding more information to a function name so that it can be distinguished from other functions by the compiler

2.The process of making common names for all the function of C++ program for better use

3.The process of changing the names of variable

4.The process of declaring variables of different types


Question:
What is static binding?

1.The process of linking the actual code with a procedural call during run-time

2.The process of linking the actual code with a procedural call during compile-time

3.The process of linking the actual code with a procedural call at any-time

4.All of the mentioned


Question:
What is std in C++?

1.std is a standard class in C++

2.std is a standard namespace in C++

3.std is a standard header file in C++

4.std is a standard file reading header in C++


Question:
What is the correct syntax of declaring array of pointers of integers of size 10 in C++?

1. int arr = new int[10];

2.int **arr = new int*[10];

3.int *arr = new int[10];

4. int *arr = new int*[10];


Question:
What is the difference between delete and delete[] in C++?

1.delete is used to delete normal objects whereas delete[] is used to pointer objects

2.delete is a keyword whereas delete[] is an identifier

3.delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects

4.delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case


Question:
What is the other name of compile-time polymorphism?

1.Static polymorphism

2.Dynamic polymorphism

3.Executing polymorphism

4.Non-executing polymorphism


Question:
What is the other name of run-time polymorphism?

1.Static polymorphism

2.Dynamic polymorphism

3.Executing polymorphism

4.Non-executing polymorphism


Question:
What is the size of a boolean variable in C++?

1.1 bit

2.1 byte

3.4 bytes

4.2 bytes


Question:
What is the size of a character literal in C and C++?

1.4 and 1

2. 1 and 4

3.1 and 1

4. 4 and 4


Question:
What is the size of a character type in C and C++?

1.4 and 1

2.1 and 4

3.1 and 1

4.4 and 4


Question:
What is the size of wchar_t in C++?

1.2

2.4

3.2 or 4

4.Based on the number of bits in the system


Question:
What is the value of the bool?  bool is_int(789.54)

1.TRUE

2.FALSE

3.1

4.2


Question:
What is virtual inheritance?

1.C++ technique to avoid multiple copies of the base class into children/derived class

2.C++ technique to avoid multiple inheritances of classes

3.C++ technique to enhance multiple inheritance

4.C++ technique to ensure that a private member of the base class can be accessed somehow


Question:
When a language has the capability to produce new data type mean, it can be called as

1.overloaded

2.extensible

3.encapsulated

4.reprehensible


Question:
Which data type is used to represent the absence of parameters?

1. int

2. short

3.void

4. float


Question:
Which of the following feature is not provided by C?

1.Pointers

2.Structures

3.References

4.Functions


Question:
Which of the following is accessed by a member function of a class?

1.The object of that class

2.All members of a class

3. The public part of a class

4.The private part of a class


Question:
Which of the following is an entry-controlled loop?

1. for

2.while

3.do-while

4.both while and for


Question:
Which of the following is an exit-controlled loop?

1. for

2.while

3.do-while

4.all of the mentioned


Question:
Which of the following is C++ equivalent for printf()?

1.cin

2.cout

3.print

4. input


Question:
Which of the following is C++ equivalent for scanf()?

1. cin

2.cout

3. print

4.input


Question:
Which of the following is correct about dynamic polymorphism?

1.In dynamic polymorphism, the conflict between the function call is resolved during the compile time

2.In dynamic polymorphism, the conflict between the function call is resolved during the run time

3.In dynamic polymorphism, the conflict between the function call is never resolved during the execution of the program

4.In dynamic polymorphism, the conflict between the function call is resolved at the beginning of the program


Question:
Which of the following is correct about new and malloc?

1. Both are available in C

2.Pointer object initialization of a class with both new and malloc calls the constructor of that class

3. Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call

4.Pointer object initialization of a class using malloc involves constructor call whereas using new does not involve constructor call


Question:
Which of the following is correct about static polymorphism?

1.In static polymorphism, the conflict between the function call is resolved during the compile time

2.In static polymorphism, the conflict between the function call is resolved during the run time

3.In static polymorphism, the conflict between the function call is never resolved during the execution of a program

4.In static polymorphism, the conflict between the function call is resolved only if it required


Question:
Which of the following is correct about this pointer in C++?

1.this pointer is passed as a hidden argument in all the functions of a class

2.this pointer is passed as a hidden argument in all non-static functions of a class

3.this pointer is passed as a hidden argument in all static functions of a class

4.this pointer is passed as a hidden argument in all static variables of a class


Question:
Which of the following is correct?

1.struct tag is required in both C and C++ while declaring an object of the structure

2.struct is not required in C but required in C++ while declaring an object of the structure

3.struct is not required in C++ but required in C while declaring an object of the structure

4.struct tag is not required in both C and C++ while declaring an object of the structure


Question:
Which of the following is correct?

1.struct cannot have member function in C but it can in C++

2.struct cannot have member function in C++ but it can in C

3.struct cannot have member function in both C and C++

4.struct can have member function in both C and C++


Question:
Which of the following is not a fundamental type is not present in C but present in C++?

1.int

2.float

3. bool

4.void


Question:
Which of the following is the correct difference between cin and scanf()?

1.both are the same

2.cin is a stream object whereas scanf() is a function

3.scanf() is a stream object whereas cin is a function

4.cin is used for printing whereas scanf() is used for reading input


Question:
Which of the following is the scope resolution operator?

1. .

2.*

3.::

4.~


Question:
Which of the following operator has left to right associativity?

1.Unary operator

2. Logical not

3.Array element access

4.addressof


Question:
Which of the following operator is used with this pointer to access members of a class?

1..

2.!

3.->

4.~


Question:
Which of the following statement is correct?

1.Structure in C allows Constructor definition

2.Structure in C++ allows Constructor definition

3.Both allow Constructor definition

4.C allows constructor definition while C++ does not


Question:
Which of the following syntax can be used to use a member of a namespace without including that namespace?

1.namespace::member

2.namespace->member

3.namespace.member

4.namespace~member


Question:
Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?

1.struct STRUCT S;

2.STRUCT S;

3.Both struct STRUCT S; and STRUCT S;

4.Both C and C++ have different syntax


Question:
Which of the following type is provided by C++ but not C?

1. int

2.bool

3.float

4. double


Question:
Which type is best suited to represent the logical values?

1.integer

2. boolean

3.character

4.float


Question:
Why this pointer is used?

1.To access the members of a class which have the same name as local variables in that scope

2.To access all the data stored under that class

3.To access objects of other class

4.To access objects of other variables


More MCQS

  1. C++ Programming MCQS Set-1
  2. C++ Multiple Choice Questions Set-1
  3. C++ Multiple Choice Questions Set-2
  4. C++ Programming MCQS Set-2
  5. C++ Programming MCQS Set-3
  6. C++ Programming MCQS Set-4
  7. C++ (CPP) MCQ Question with Answer
  8. Advanced c++ multiple choice question(MCQS)
  9. OOPS Quiz Questions and Answers(MCQS)
  10. C Programming - MCQ Questions Set 1
  11. C Programming - MCQ Questions Set 2
  12. C Programming - MCQ Questions Set 3
  13. C Programming - MCQ Questions Set 4
  14. C Programming - MCQ Questions Set 5
  15. C++ programming language MCQ Questions Set 1
  16. C++ programming language MCQ Questions Set 2
  17. C++ programming language MCQ Questions Set 3
  18. C++ programming language MCQ Questions Set 4
  19. C++ programming language MCQ Questions Set 5
  20. C++ Programming -Constructors and Destructors
  21. C++ Programming -OOPS Concepts
  22. C++ Programming - References
  23. C++ Programming - Functions
  24. C MCQS:-The ABC of C
  25. C MCQS Interview Questions
  26. C++ Questions and Answers OOPs Basic Concepts
  27. C++ Questions and Answers Returning Objects
  28. C Programming MCQ Part 1
  29. C Programming MCQ
  30. Computer Science & Engineering C Multiple Choice Questions set 1
  31. Computer Science & Engineering C Multiple Choice Questions set 2
  32. C Multiple Choice Questions C Functions Set 1
  33. C Multiple Choice Questions C Functions Set 2
  34. C Multiple Choice Questions C Operators
  35. C Multiple Choice Questions & AnswersConditional Expressions
  36. C Multiple Choice Questions & Answers Data Types
  37. C Multiple Choice Questions & Answers File Access
  38. Computer Science & Engineering Cloud Computing MCQs Part 1
  39. CPP Programming MCQ Set 1
  40. CPP Programming MCQ Set 2
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!